package com.tianshuo.importtest.main;

import com.tianshuo.importtest.SelectorImpl;
import com.tianshuo.importtest.config.ImportConfig;
import com.tianshuo.mybatis.model.UserServiceImpl;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @ClassName : ImportApplicationContextTest
 * @Description : 测试@Import的三种使用方式
 * @Author : tianshuo
 * @Date: 2021-03-02 15:24
 */
public class ImportApplicationContextTest {

    public static void main(String[] args) {

        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(ImportConfig.class);
        applicationContext.refresh();
        AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition().getBeanDefinition();
        System.out.println(applicationContext.getBean(UserServiceImpl.class));

    }
}

